<%@ page import="java.sql.ClientInfoStatus" %>
<%@ page import="java.util.*" %><%--
  Created by IntelliJ IDEA.
  User: hp
  Date: 2021/6/19
  Time: 17:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java"
    errorPage="123.jsp"
%>
<html>
<head>
    <title>Title</title>
</head>
<body>
<!--1. JSP 九大内置对象的使用-->
 <!--1.1request对象-->
<br>
%><%request.setAttribute("a1","qwe");%>
 request=<%=request.getAttribute("a1")%><br>
<!--1.2response对象-->
<%//response.sendRedirect("123.jsp");
 response.getWriter().write("123456789");
%>
 <!--1.3session对象-->
<% session.setAttribute("a2","asd");%>
session=<%=session.getAttribute("a2")%><br>
 <!--1.4application对象-->
<% application.setAttribute("a3","qaz");%>
appliccation=<%=application.getAttribute("a3")%><br>
 <!--1.5out对象-->
out=<%out.print("123456");%><br>
 <!--1.6pageContext对象-->
<%pageContext.setAttribute("a4","wsx");%>
pageContext=<%=pageContext.getAttribute("a4")%><br>
 <!--1.7config对象-->
<%String url= config.getServletContext().getRealPath("/image");%>

url=<%=url%><br>
 <!--1.8page对象-->
 <!--<%@ page contentType="text/html;charset=UTF-8" language="java" %>-->
 <!--1.9exception对象-->
 <%//=6/0%>
<!--2. JSP 的三大指令-->
 <!--2.1page指令-->
 <!-- @page contentType="text/html;charset=UTF-8" language="java"
             errorPage="123.jsp"-->
 <!--2.2include指令-->
<%@include file="1.jsp"%>
<%@include file="2.jsp"%>
<%@include file="3.jsp"%><br>
 <!--2.3taglib指令-->
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!--3. JSTL 语法格式和使用方式 -->
<c:set value="输入的值" var="str" scope="request"></c:set>
str=<c:out value="${str}"></c:out>
<c:remove var="str" scope="request"></c:remove>
str=<c:out value="${str}"></c:out><br>
<c:set value="20" var="age" scope="request"></c:set>
<c:if test="${age>15 and age<30}">
    青年
</c:if><br>
<c:choose>
    <c:when test="${age<15}">
        未成年
    </c:when>
    <c:when test="${age>30}">
        成年
    </c:when>
    <c:otherwise>
        青年
    </c:otherwise>
</c:choose><br>
<%
    List list = new ArrayList();
    list.add("张三");
    list.add("李四");
    list.add("王五");
    pageContext.setAttribute("ulist",list);
%>
<c:forEach items="${ulist}" var="user" varStatus="stu">
    ${stu.count}-${user}<br>
</c:forEach><br>
<c:forEach items="${ulist}" var="user" varStatus="stu">
    ${stu.index}-${user}<br>
</c:forEach><br>
<%
    pageContext.setAttribute("nowtime",new Date());
%>
nowtime=${nowtime}<br>
nowtime=<fmt:formatDate value="${nowtime}" pattern="yyyy-MM-dd"></fmt:formatDate><br>

<!--4. EL 表达式语法格式-->
<%
List list1 = new ArrayList();
list1.add("456");
pageContext.setAttribute("a4",list1);
%>

list1=${a4[0]}<br>
<%
    Map m = new HashMap();
    m.put("k1","麻子");
    pageContext.setAttribute("a5",m);
%>
m=${a5.k1}
</body>
</html>
